package socket.socketandserversocket;

import java.io.BufferedInputStream;
import java.io.IOException;

public class ReadThread implements Runnable {
    private BufferedInputStream bis;

    public ReadThread(BufferedInputStream bis) {
        this.bis = bis;
    }

    byte[] bytes = new byte[1024];
    int len = 0;

    @Override
    public void run() {
        while (true) {
            while (true) {
                try {
                    if (((len = bis.read(bytes)) != -1))
                        System.out.println(new String(bytes, 0, len));
                    ;
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
